#{extends 'main.html' /}
#{set title:'MyNewEv' /}

#{if user}
<div id='cssmenu'>
<ul>
   <li><a href='/home'><span>Home</span></a></li>
   <li><a href='/category'><span>Create event</span></a></li>
   <li class='active'><a href='/myevents'><span>My events</span></a></li>
   <li><a href='/registeredevents'><span>Registered events</span></a></li>
</ul>
</div>
#{/if}
		<br/>
		<center>
		<nav-header>
			<a href="/trips"> Trips </a>
			<a href="/sports"> Sport </a>
			<a href="/culture"> Culture </a>
			<a href="/entertainment"> Entertainment </a>
			<a href="/night_life"> Night life </a>
			<a href="/learning"> Learning </a>
		</nav-header>
		</center>
		<div class="container">
			<!--<div id="adds">adds
			</div>-->


<h2>My events</h2>

	<center>
	<table>
	#{list items:user.ownEvents, as:'event'}
		#{if event_parity.equals("odd")} 
			<tr>
		#{/if}
			<td>
			<a href="@{EventManager.detailedevent(event.id)}">
			<div class="eventslist" >
				<div class=${event.categoryString} #{if event_parity==odd} #{/if} >
					<h4> ${event.title} </h4>
					<div class="photo"></div>
					<p class="eventcontent">
						Author: ${event.author.userName} <br/>
						Category: ${event.category} <br/>
						Date: ${(event.eventDate).format('dd MMMM yyyy')} <br/>
						Location: ${event.location} <br/>
						Comments: ${event.comments.size()} <br/>
						Registered: ${event.registeredUsers.size()} <br/>
					</p>
				</div>
			</div>
			</a>
			</td>
		#{if event_parity.equals("even")} 
			</tr>
		#{/if}	
	#{/list}
	</table>
	</center>


</div>